<template>
    <view class="container">
        <view class="list">
            <view class="card" v-if="doubleBoxCard.is_show">
                <view class="card-img">
                    <image src="https://img121.7dun.com/yuanqimali/myCard/cardLogo.png"></image>
                </view>
                <view class="top">
                    <view class="title">{{ doubleBoxCard.double_card_info.title }}</view>
                    <view class="desc">{{ '' + doubleBoxCard.double_card_info.description + '' }}</view>
                </view>
                <view class="total">x < text>{{ doubleBoxCard.my_balance }}</view>
            </view>
            <no-data @__l="__l" vueId="9fe102a4-1" v-if="!excludeBoxCard.is_show && !showBoxCard.is_show && !doubleBoxCard"></no-data>
        </view>
    </view>
</template>

<script>
import noData from '@/components/NoData/NoData';
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['pages/myCard/index'],
    {
        '333c': function (t, e, o) {
            'use strict';

            var n = o('9465');
            o.n(n).a;
        },
        '399d': function (t, e, o) {
            'use strict';

            o.r(e);
            var n = o('e206');
            var r = o.n(n);
            for (var c in n) {
                if (['default'].indexOf(c) < 0) {
                    (function (t) {
                        o.d(e, t, function () {
                            return n[t];
                        });
                    })(c);
                }
            }
            e.default = r.a;
        },
        '8b44': function (t, e, o) {
            'use strict';

            o.r(e);
            var n = o('a391');
            var r = o('399d');
            for (var c in r) {
                if (['default'].indexOf(c) < 0) {
                    (function (t) {
                        o.d(e, t, function () {
                            return r[t];
                        });
                    })(c);
                }
            }
            o('333c');
            var a = o('f0c5');
            var i = Object(a.a)(r.default, n.b, n.c, false, null, null, null, false, n.a, void 0);
            e.default = i.exports;
        },
        9465: function (t, e, o) {},
        a391: function (t, e, o) {
            'use strict';

            o.d(e, 'b', function () {
                return r;
            });
            o.d(e, 'c', function () {
                return c;
            });
            o.d(e, 'a', function () {
                return n;
            });
            var n = {
                NoData: function () {
                    return o.e('components/NoData/NoData').then(o.bind(null, 'cafe'));
                }
            };
            var r = function () {
                this.$createElement;
                this._self._c;
            };
            var c = [];
        },
        aeea: function (t, e, o) {
            'use strict';

            (function (t, e) {
                var n = o('4ea4');
                o('18ba');
                n(o('66fd'));
                var r = n(o('8b44'));
                t.__webpack_require_UNI_MP_PLUGIN__ = o;
                e(r.default);
            }.call(this, o('bc2e').default, o('543d').createPage));
        },
        e206: function (t, e, o) {
            'use strict';

            (function (t) {
                var n = o('4ea4');
                Object.defineProperty(e, '__esModule', {
                    value: true
                });
                e.default = void 0;
                var r = n(o('9523'));
                function c(t, e) {
                    var o = Object.keys(t);
                    if (Object.getOwnPropertySymbols) {
                        var n = Object.getOwnPropertySymbols(t);
                        if (e) {
                            n = n.filter(function (e) {
                                return Object.getOwnPropertyDescriptor(t, e).enumerable;
                            });
                        }
                        o.push.apply(o, n);
                    }
                    return o;
                }
                var a = {
                    components: {},
                    data: function () {
                        return {
                            showBoxCard: {
                                score_price: 0,
                                my_balance: 0
                            },
                            excludeBoxCard: {
                                score_price: 0,
                                my_balance: 0
                            },
                            doubleBoxCard: {
                                score_price: 0,
                                my_balance: 0
                            }
                        };
                    },
                    computed: (function (t) {
                        for (var e = 1; e < arguments.length; e++) {
                            if (null != arguments[e]) {
                                var o = arguments[e];
                            } else {
                                var o = {};
                            }
                            if (e % 2) {
                                c(Object(o), true).forEach(function (e) {
                                    (0, r.default)(t, e, o[e]);
                                });
                            } else {
                                Object.getOwnPropertyDescriptors
                                    ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(o))
                                    : c(Object(o)).forEach(function (e) {
                                          Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(o, e));
                                      });
                            }
                        }
                        return t;
                    })({}, (0, o('26cb').mapGetters)(['userInfo'])),
                    onLoad: function () {},
                    onShow: function () {
                        this.initData();
                    },
                    methods: {
                        initData: function () {
                            var that = this;
                            this.$store.dispatch('getUserInfo');
                            this.$http('/user/cards').then(function (e) {
                                that.showBoxCard = e.data.show_box_card;
                                that.excludeBoxCard = e.data.exclude_box_card;
                                that.doubleBoxCard = e.data.double_box_card;
                                console.log(e.data.double_box_card);
                            });
                        },
                        getShowBoxCard: function () {
                            var that = this;
                            console.log(this.showBoxCard.score_price);
                            if (!this.showBoxCard.score_price) {
                                t.showToast({
                                    title: '暂无可兑换通道',
                                    icon: 'none'
                                });
                                return false;
                            }
                            t.showModal({
                                title: '确认兑换透视卡',
                                content: '支付' + this.showBoxCard.score_price + this.scoreAlias + '兑换1张透视卡',
                                success: function (o) {
                                    if (o.confirm) {
                                        t.showLoading({
                                            title: '兑换中',
                                            mask: true
                                        });
                                        that.$http('/card-orders', 'POST', {
                                            type: 'show_box'
                                        }).then(function (o) {
                                            that.initData();
                                            t.showToast({
                                                title: '恭喜兑换成功啦~',
                                                icon: 'none'
                                            });
                                        });
                                    }
                                }
                            });
                        },
                        getExcludeBoxCard: function () {
                            var that = this;
                            console.log(this.excludeBoxCard.score_price);
                            if (!this.excludeBoxCard.score_price) {
                                t.showToast({
                                    title: '暂无可兑换通道',
                                    icon: 'none'
                                });
                                return false;
                            }
                            t.showModal({
                                title: '确认兑换排除卡',
                                content: '支付' + this.excludeBoxCard.score_price + this.scoreAlias + '兑换1张排除卡',
                                success: function (o) {
                                    if (o.confirm) {
                                        t.showLoading({
                                            title: '兑换中',
                                            mask: true
                                        });
                                        that.$http('/card-orders', 'POST', {
                                            type: 'exclude_box'
                                        }).then(function (o) {
                                            that.initData();
                                            t.showToast({
                                                title: '恭喜兑换成功啦~',
                                                icon: 'none'
                                            });
                                        });
                                    }
                                }
                            });
                        },
                        getDoubleBoxCard: function () {
                            var that = this;
                            console.log(this.doubleBoxCard.score_price);
                            if (!this.doubleBoxCard.score_price) {
                                t.showToast({
                                    title: '暂无可兑换通道',
                                    icon: 'none'
                                });
                                return false;
                            }
                            t.showModal({
                                title: '确认兑换' + this.doubleBoxCard.double_card_info.title,
                                content: '支付' + this.doubleBoxCard.score_price + this.scoreAlias + '兑换1张' + this.doubleBoxCard.double_card_info.title,
                                success: function (o) {
                                    if (o.confirm) {
                                        t.showLoading({
                                            title: '兑换中',
                                            mask: true
                                        });
                                        that.$http('/card-orders', 'POST', {
                                            type: 'double_box'
                                        }).then(function (o) {
                                            that.initData();
                                            t.showToast({
                                                title: '恭喜兑换成功啦~',
                                                icon: 'none'
                                            });
                                        });
                                    }
                                }
                            });
                        }
                    }
                };
                e.default = a;
            }.call(this, o('543d').default));
        }
    },
    [['aeea', 'common/runtime', 'common/vendor']]
]);
</script>
<style>
@import './index.css';
</style>
